package com.foredu.fiqs.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 * Description:<br/>
 * 领域模型：工资类，代表教职工的工资，按月发放<br/>
 * Date:<br/>
 * 2014/5/13<br/>
 * 
 * @author hushigang
 */

@Entity
@Table(name = "T_Salary")
public class Salary implements Serializable {

	private static final long serialVersionUID = 1L;
	private int id;//工资ID
	private int year;// 所属年份
	private int month;// 所属月份
	private String payDate;// 工资发放日期
	private Employee employee;// 所属职工
	private Set<SalaryItem> salaryItems;// 工资条目集合
	private float total;//工资实发总计
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column
	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	@Column
	public int getMonth() {
		return month;
	}

	public void setMonth(int month) {
		this.month = month;
	}

	@Column
	public String getPayDate() {
		return payDate;
	}

	public void setPayDate(String payDate) {
		this.payDate = payDate;
	}

	@ManyToOne
	@JoinColumn(name = "employee_id")
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@OneToMany(cascade=CascadeType.ALL, mappedBy = "salary")
	@OrderBy(value = "id ASC")
	public Set<SalaryItem> getSalaryItems() {
		return salaryItems;
	}

	public void setSalaryItems(Set<SalaryItem> salaryItems) {
		this.salaryItems = salaryItems;
	}

	@Column
	public void setTotal(float total) {
		this.total = total;
	}

	public float getTotal() {
		return total;
	}

}
